-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tarkista lommakkeella tallennettavien määräysryhmien lyhyet nimet #197
The head ref may contain hidden characters: "158-tarkistus-siit\u00E4-ettei-k\u00E4ytt\u00E4j\u00E4-ole-lis\u00E4\u00E4m\u00E4ss\u00E4-m\u00E4\u00E4r\u00E4ysryhm\u00E4\u00E4-olemassa-olevalla-lyhyell\u00E4-nimell\u00E4"
Tarkista lommakkeella tallennettavien määräysryhmien lyhyet nimet #197
Conversation
Now PlanManager has a variable for reg. groups from active plan that is updated when needed. Previously all regulation groups were read from DB every time reg. groups from active plan were needed for some form.
c200e5c
to
d1800d0
Compare
@@ -57,7 +62,9 @@ def __init__( | |||
self.regulation_groups_tree_layout: QVBoxLayout | |||
|
|||
# INIT | |||
self.regulation_group_libraries = regulation_group_libraries | |||
self.existing_group_short_names = active_plan_regulation_groups_library.get_short_names() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voisi muuttaa set:ksi, niin haku tehokkaampaa. Ei nyt oikeesti tässä mittaluokassa merkittävää.
Tai sitten tuon get_short_names()
voisi muuttaa palauttamaan suoraan set:n.
self.existing_group_short_names = active_plan_regulation_groups_library.get_short_names() | |
self.existing_group_short_names = set(active_plan_regulation_groups_library.get_short_names()) |
arho_feature_template/core/models.py
Outdated
def get_short_names(self) -> list[str]: | ||
"""Returns list of non-empty short names (letter codes) of regulation groups part of the library.""" | ||
short_names = [] | ||
for category in self.regulation_group_categories: | ||
for regulation_group in category.regulation_groups: | ||
short_name = regulation_group.short_name | ||
if short_name: | ||
short_names.append(short_name) | ||
return short_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saisi hoidettua yhdellä list comprehensionilla, mutta en sitte tiiä kumpi on selkolukuisempi.
Tai oikeestaan, jos ei järjestyksellä tai duplikaateilla ole merkitystä, niin voisi muuttaa palauttamaan suoraan set:n, jolloin haku tästä olisi tehokkaampaa.
def get_short_names(self) -> list[str]: | |
"""Returns list of non-empty short names (letter codes) of regulation groups part of the library.""" | |
short_names = [] | |
for category in self.regulation_group_categories: | |
for regulation_group in category.regulation_groups: | |
short_name = regulation_group.short_name | |
if short_name: | |
short_names.append(short_name) | |
return short_names | |
def get_short_names(self) -> set[str]: | |
return { | |
regulation_group.short_name | |
for category in self.regulation_group_categories | |
for regulation_group in category.regulation_groups | |
if regulation_group.short_name | |
} |
d1800d0
to
ab824b3
Compare
No description provided.